<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <title>Hiring-</title>
        <%@ include file="/WEB-INF/view/common/import.jsp"%>
    </head>
    <body>
    	<div class="container">
    		<c:forEach begin="1" end="10">
	    		<div class="panel panel-primary">
				  <div class="panel-heading">
				    <h3 class="panel-title"><strong><kbd>1</kbd> &nbsp; 上善云图</strong>&nbsp;&nbsp;"干"</h3>
				  </div>
				  <div class="panel-body">
				       <a href="">攻城狮</a> &nbsp;&nbsp; ￥0~1 &nbsp;&nbsp; 重庆 &nbsp;&nbsp;
				  </div>
				</div>
			</c:forEach>
    	</div>
    	
		<script>
			var footerSmall = document.querySelector('.footer-small');
			// 滚动条总共高度(scrollHeight) = 滚动过的高度(scrollTop) + 屏幕的可见高度(windowHeight)
			var scrollHeight = document.body.scrollHeight || document.documentElement.scrollHeight;
			var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
			var flag = true;
			window.onscroll = function() {
				var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
				if(scrollHeight - (scrollTop + windowHeight) <= 50 && flag) {
					flag = false;
					$.get('<%=request.getContextPath()%>/CommonServlet?command=loadingData&time=' + new Date().getTime(), function(datas) {
						var html = [];
						for (var i = 0; i < datas.length; i++) {
							html.push('<div class="panel panel-primary">');
							html.push('  <div class="panel-heading">');
							html.push('    <h3 class="panel-title"><strong><kbd>1</kbd> &nbsp; ' + datas[i].companyName + '</strong>&nbsp;&nbsp;"' + datas[i].slogan + '"</h3>');
							html.push('  </div>');
							html.push('  <div class="panel-body">');
							html.push('    <a href="">' + datas[i].positionName + '</a> &nbsp;&nbsp; ￥' + datas[i].salary1 + '~' + datas[i].salary2 + ' &nbsp;&nbsp; ' + datas[i].address + ' &nbsp;&nbsp;');
							html.push('  </div>');
							html.push('</div>');
						}
						$('.container').append(html.join(''));
						scrollHeight = document.body.scrollHeight || document.documentElement.scrollHeight;
						flag = true;
					}, 'json')
				} 
			}
		</script>
    </body>
</html>
